﻿/**
 * Copyright (C) 2011 original author and authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NGuice.Inject.Matcher
{
    /// <summary>
    /// C#无法执行泛型通配符操作，使用此标记接口解决此问题
    /// </summary>
    public interface IMatcher 
    {
        bool Matches(object t);
    }

    /// <summary>
    /// 匹配输入的匹配器
    /// </summary>
    public interface IMatcher<T> : IMatcher
    {
        /// <summary>
        /// 如果匹配器匹配参数返回true
        /// </summary>
        bool Match(T t);

        /// <summary>
        /// 两个匹配器做And操作
        /// </summary>
        /// <param name="other">必须为泛型类型，且泛型参数必须为T的超类型</param>
        IMatcher<T> And(IMatcher other);

        /// <summary>
        /// 两个匹配器做Or操作
        /// </summary>
        /// <param name="other">必须为泛型类型，且泛型参数必须为T的超类型</param>
        IMatcher<T> Or(IMatcher other);
    }

}
